<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html>
<html lang="en">
<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>考试</title>
		<meta name="description" content="User login page" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/bootstrap.min.css" />
		<link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/font-awesome.min.css" />
		<!-- text fonts -->
		<link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/ace-fonts.css" />
		<!-- ace styles -->
		<link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/ace.min.css" />
		<link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/ace.onpage-help.css" />
<style type="text/css">
ul{
	list-style:none;
}
</style>

</head>
<body class="no-skin">
	<form:form action="countScore" modelAttribute="testList" method="post">
		<div class="main" style="margin: auto;width: 1400px;height: auto; background-color: #FFFFFF;padding: 10px;">
			<h1 style="text-align: center;">【考试】${subject.name }<form:hidden path="subId" id="subId" value="${subject.subId }"/></h1>
				<div id="questionTile">本次考试的参考时长为：${subject.totalTime } 分钟   总分为：${subject.totalScore } 分</div>
					<div id="Testtime" style="text-align: center;"><h4 class="time"></h4></div><hr/>
						<div id="showQuestion">
 
<c:forEach items="${list }" var="list" varStatus="index">

	<div id="q_${index.count }">
	<div id="testTile">${index.count },
		<span>${list.examTestTypeVo.testType}</span>
		<span>（${list.examTestTypeVo.testTypeScore}分）</span>
		<span>${list.content }</span>
		<form:hidden value="${list.id }" path="questlist[${index.index }].hiddenId" id="q_${index.count }_Id"/>
	</div>
	
	<div class="testAnswer">
		<ul style="list-sytle:none;">
			<c:if test="${list.examTestTypeVo.testTypeScore == 10}">
				<li ><span><form:checkbox path="questlist[${index.index }].q_1" value="A"/></span>
					<span>A,</span>
					<span>${list.chooseA }</span>
				</li>
				<li><span><form:checkbox path="questlist[${index.index }].q_2" value="B"/></span>
					<span>B,</span>
					<span>${list.chooseB }</span>
				</li>
				<li><span><form:checkbox path="questlist[${index.index }].q_3" value="C" /></span>
					<span>C,</span>
					<span>${list.chooseC }</span>
				</li>
				<li><span><form:checkbox path="questlist[${index.index }].q_4" value="D" /></span>
				<span>D,</span>
				<span>${list.chooseD }</span>
				</li>
			</c:if>
			<c:if test="${list.examTestTypeVo.testTypeScore == 5}">
				<li><span><form:radiobutton path="questlist[${index.index }].q_1" value="A"/></span>
					<span>A,</span>
					<span>${list.chooseA }</span>
				</li>
				<li><span><form:radiobutton path="questlist[${index.index }].q_1" value="B" /></span>
				<span>B,</span>
				<span>${list.chooseB }</span>
				</li>
				<li><span><form:radiobutton path="questlist[${index.index }].q_1" value="C" /></span>
				<span>C,</span>
				<span>${list.chooseC }</span>
				</li>
				<li><span><form:radiobutton path="questlist[${index.index }].q_1" value="D" /></span>
				<span>D,</span>
				<span>${list.chooseD }</span>
				</li>
			</c:if>
		</ul>
	</div>
	</div><hr/>
</c:forEach>
</div>
<div style="text-align: center;">
	<button id="formBtn" type="submit" style="margin-right:30px" class="btn btn-primary">提交</button>
	<button id="returnBtn" onclick="javascript:window.history.go(-1);" class="btn btn-default">返回</button>
</div>
</div>
</form:form>
<script src="${pageContext.request.contextPath}/static/lib/jquery-1.11.1.min.js"></script>
<script src='${pageContext.request.contextPath}/static/lib/joinTest.js'></script>
<script type="text/javascript">
	var hour = 0;
	var minute = 0;
	var second = 0;
	var showtime = $('.time');
	var t;
	hour = ${dateTime_hour};
	minute = ${dateTime_minute};
	second = ${dateTime_second};	
	
	showtime.text('考试时间剩下：  '+hour+' 小时 '+minute+' 分 '+second+' 秒');
	function timedCount(){
		showtime.text('考试时间剩下：  '+hour+' 小时 '+minute+' 分 '+second+' 秒'); 
		if(second == 0 | second < 0){
			second = 60;
		}
	 	if(second == 60){
			if(minute == 0){
				if(hour == 0){
					hour = 0;
				}else if(hour > 0 ){
					hour--;
					minute = 59;
				}
			}else if (minute > 0){
					--minute;
				}
		} 
		--second;
		t = setTimeout("timedCount()",1000);
		if(hour == 0 && minute == 0 && second ==0){
			clearTimeout(t);
			showtime.text("考试已经结束");
			alert("再接再厉，来年再战！");
			window.location.href="http://localhost:8080/OnlineExam/score";
		}
	}
	timedCount();
	
	
</script>
</body>
</html>
